<template>
	<el-card class="main2">
		<div slot="header">
			<span>成绩管理/班级成绩查询</span>
		</div>
		<p>
			<el-select v-model="banjiId" clearable placeholder="请选择班级" :size="size">
				<el-option v-for="bj in bjs" :key="bj.id" :value="bj.id" :label="bj.name"></el-option>
			</el-select>
		</p>
		<el-table v-if="banjiId" :data="data" border :size="size">
			<el-table-column v-for="(col,index) in cols" :key="index" :prop="col" :label="col"></el-table-column>
		</el-table>
	</el-card>
</template>

<script>
	export default {
		data() {
			return {
				bjs: [],
				banjiId:'',
				size:'small',
				cols:[],
				data:[],
			}
		},
		mounted() {
			this.$ajax.post('banji/list',{}).then(res=>{
				var result=res.data;
				this.bjs=result;
			})
		},
		watch:{
			banjiId(val){
				if(val){
					this.$ajax.post('grade/banjiGradeList',{tbClassId:val}).then(res=>{
						var result=res.data;
						this.cols=result.cols;
						this.data=result.tableData;
					})
				}
			}
		}
	}
	
</script>

<style>
</style>
